package com.danger.Presenter;

import android.content.Context;

import com.danger.Model.action.RegisterModel;
import com.danger.Model.action.RegisterModelImpl;
import com.danger.Model.bean.RegisterUserInfo;
import com.danger.View.RegisterView;

/**
 * Created by danger on 2016/3/18.
 */
public class RegisterPresenterImpl implements RegisterPresenter {

    private RegisterModel registerModel;
    private RegisterView registerView;
    private Context context;
    private RegisterUserInfo registerUserInfo;

    public RegisterPresenterImpl(Context context, RegisterView registerView) {
        this.context = context;
        this.registerView = registerView;
        registerModel = new RegisterModelImpl();
    }

    @Override
    public boolean toNext() {
        registerUserInfo = registerView.getRegisterUserInfo();
        String msg = registerModel.check(registerUserInfo);
        if (msg.equals("正确")) {
            return true;
        } else {
            registerView.showError(msg);
        }
        return false;
    }
}
